<?php

namespace XWAM\Addon\POrgDocument\Controller;

/**
 * AdvertisingController类
 *
 * @since 1.0 <2015-10-23> SoChishun <14507247@qq.com> Added.
 */
class AdvertisingController extends AddonbaseController {

    public function advert_list() {
        $list = AddonD('Advertising')->select();
        $this->assign('list', $list);
        $this->display_cpp();
    }

    function advert_copy($id = 0) {
        if (!$id) {
            $this->ajaxMsg(false, '参数无效');
        }
        AddonD('Advertising')->copy_advert($id);
        $this->ajaxMsg(true);
    }

    function advert_edit($id = 0) {
        $data = $id ? AddonD('Advertising')->find($id) : array();
        $this->assign('data', $data);
        $this->display();
    }

    function advert_edit_save() {
        $result = AddonD('Advertising')->save_advert();
        $this->dialogJump($result['status'], $result['info']);
    }

    function advert_delete($id = '') {
        $result = AddonD('Advertising')->delete_advert($id);
        $this->ajaxReturn($result);
    }

}
